$(function () {
    //页面加载完成获取第一页数据
    getTeacherList(1);
    $("body").on('click','#btn1,#btn2,#btn3',function () {
        //点击搜索查询从第一页开始查询
        getTeacherList(1);
    });
    /**
     * 获取讲师列表页面
     * @param pageNo 当前页码
     */
    function getTeacherList(pageNo) {
        var params = $("#search-form").serializeJSON();
        params = JSON.stringify(params);
        var obj = {
            url: baseloaction + '/admin/manage/teacher/ajaxSelectTeacherList',//请求URL
            contextId:'teacher-list-context',//响应内容页面设置内容ID
            params:params,//请求参数
            pageNo:pageNo,//页码
            pageCall:getTeacherList, //分页回调加载数据(点击上下页时调用,该方法也在加载页面完成时调用)
            selectAllId:'select-all-teacher', //全选框ID
            callback:function (pageNo) {//数据加载完成回调
                $("#count").text(total);
            }
        };
        ajaxGetListData(obj);
    }
});

/**
 * 获取选中讲师
 */
function getSelectTeacher() {
    var input = $("input:checked");
    if(input.length==0){
        icModale(0,"请选择讲师数据");
        return null;
    }
    var result = null;
    if(selectType==null || $.trim(selectType)=='' || typeof  selectType =='undefined' || selectType=='radio'){
        result = input[0];
        var _u = $(input[0]);
        result = {'id':_u.val(),'teacherName':_u.attr("title")};
    }else{
        result = new Array();
        $.each(input,function (index,_u) {
            _u = $(_u);
            var _user = {'id':_u.val(),'teacherName':_u.attr("title")};
            result.push(_user);
        });
    }
    return result;
}